<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * Class CreateRecordsTable
 * 病历记录数据表
 */
class CreateMedicalRecordsTable extends Migration
{
    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('st_medical_records', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('patient_id')->index()->comment('患者表ID');
            $table->unsignedMediumInteger('hospital_id')->index()->comment('就诊医院');
            $table->unsignedInteger('doctor_id')->comment('看诊医生');
            $table->date('clinic_at')->comment('就诊日期');
            $table->string('print_auxiliary')->comment("打印辅助检查表,多个用逗号隔开");
            $table->text('medication')->comment('json西药用药');
            $table->text('cn_medication')->comment("json中药汤药");
            $table->text('interval')->comment("上次诊断距本次情况");
            $table->boolean('visit_type')->default(true)->comment('病历类型 1首诊 0复诊');
            $table->boolean('is_western')->default(false)->comment('是否西医');
            $table->unsignedInteger('updated_by')->comment('最后修改人, 关联user表');
            $table->softDeletes();
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('st_medical_records');
    }
}
